package com.sumainfor.zuul.controller;

import com.sumainfor.common.util.CustomMap;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.zuul.service.impl.Feign.MessageSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author Eddy·Chen
 * @Email 835033913@qq.com
 * @Create 2019-05-20 16:40
 */
@RestController
@RequestMapping("/sys/public")
public class PublicController {

    @Autowired
    private MessageSetService messageSetService;

    /**
     * 获取消息
     *
     * @param type
     * @param size
     * @return
     */
    @RequestMapping("/getMessage")
    public JsonResult getMessage(String type, Integer size) {
        List<Map<String, Object>> getMessageList = messageSetService.getMessageList(CustomMap.create()
                .put("MeType", type)
                .put("start", 0)
                .put("limit", size));
        return JsonResult.success(getMessageList);
    }

}
